import request from '@/utils/request'

export function typeList() {
  return request({
    url: '/item/list/type',
    method: 'get'
  })
}

export function showTypeList(query) {
  return request({
    url: '/item/show/type',
    method: 'get',
    params: query
  })
}

export function saveOrUpdateType(data) {
  return request({
    url: '/item/save/type',
    method: 'post',
    data
  })
}

export function deleteType(typeId) {
  return request({
    url: '/item/remove/type',
    method: 'get',
    params: { 'typeId': typeId }
  })
}

export function categoryList(typeId) {
  return request({
    url: '/item/list/category',
    method: 'get',
    params: { 'typeId': typeId }
  })
}

export function showCategoryList(query) {
  return request({
    url: '/item/show/category',
    method: 'get',
    params: query
  })
}

export function saveOrUpdateCategory(data) {
  return request({
    url: '/item/save/category',
    method: 'post',
    data
  })
}

export function deleteCategory(categoryId) {
  return request({
    url: '/item/remove/category',
    method: 'get',
    params: { 'categoryId': categoryId }
  })
}

